create database RecipeBuildUnits
go
use RecipeBuildUnits
go
create table admin (
	name nvarchar (100),
	pass nvarchar (100)
	)

create table Recipe (
	RecipeID int primary key identity (1,1),
	RecipeName nvarchar (100),
	CreateDate datetime,
	Status varchar(10),
	TypeID int
	)
go
create table Ingridient (
	IngID int primary key identity (1,1),
	IngName nvarchar (100),
	IngUnit nvarchar (100),
	IngTypeID int
	)
go
create table RecipeType (
	TypeID int primary key identity (1,1),
	TypeName nvarchar (100),
	)
go
create table RecipeInfo (
	InfoID int primary key identity (1,1),
	RecipeID int,
	IngID int,
	Quantity int
	)
go
create table IngType (
	IngTypeID int primary key identity (1,1),
	IngTypeName nvarchar (100)
	)
go
alter table RecipeInfo add constraint FK_RecipeID foreign key (RecipeID) references Recipe
alter table RecipeInfo add constraint FK_IngID foreign key (IngID) references Ingridient
alter table Recipe add constraint FK_RecipeType foreign key (TypeID) references RecipeType
alter table Ingridient add constraint FK_IngType foreign key (IngTypeID) references IngType
go
insert into admin values ('huy','123456')
insert into admin values ('lan','123456')
go
insert into RecipeType values ('Ăn Sáng')
insert into RecipeType values ('Món Luộc')
insert into RecipeType values ('Món Nướng')
go
insert into IngType values ('Gia Vị')
insert into IngType values ('Rau')
insert into IngType values ('Nguyên Liệu Tinh Bột')
insert into IngType values ('Thịt')
insert into IngType values ('Trứng')
go
insert into Recipe values ('Bánh Mì Trứng','02/05/2002','1',1)
insert into Recipe values ('Mì Tôm Trứng','03/04/2002','1',1)
insert into Recipe values ('Bánh Mì Ruốc','02/06/2002','1',1)
insert into Recipe values ('Rau Muống Luộc','04/11/2002','1',2)
insert into Recipe values ('Trứng Luộc','07/07/2002','1',2)
insert into Recipe values ('Thịt Heo Luộc','01/01/2002','1',2)
insert into Recipe values ('Thịt Heo Nướng','08/07/2002','1',3)
insert into Recipe values ('Gà Nướng','05/09/2002','1',3)
insert into Recipe values ('Bò Nướng','06/02/2002','1',3)
go
insert into Ingridient values ('Nước Mắm','',1)
insert into Ingridient values ('Muối','',1)
insert into Ingridient values ('Nước Lọc','',1)
insert into Ingridient values ('Dầu Ăn','',1)
insert into Ingridient values ('Rau Muống','',2)
insert into Ingridient values ('Rau Cải','',2)
insert into Ingridient values ('Dưa Chuột','',2)
insert into Ingridient values ('Hành','',2)
insert into Ingridient values ('Xả','',2)
insert into Ingridient values ('Lá Chanh','',2)
insert into Ingridient values ('Bánh Mì','',3)
insert into Ingridient values ('Cơm','',3)
insert into Ingridient values ('Mì Tôm','',3)
insert into Ingridient values ('Thịt Heo','',4)
insert into Ingridient values ('Thịt Bò','',4)
insert into Ingridient values ('Thịt Gà','',4)
insert into Ingridient values ('Trứng Gà','',5)
insert into Ingridient values ('Trứng Vịt','',5)





